#ifndef __STRATEGIES_H
#define __STRATEGIES_H

#include <iostream>
#include <fstream>
#include <string>

class Strategy;

class SortStrategies
{
public:
	SortStrategies()
	{
		strategy_ = NULL;
	}
	void setStrategy(int numberOfElements);
	void sort(int* numbers);
private:
	Strategy *strategy_;
};

class Strategy
{
  public:
	Strategy(int width): width_(width){}
	void sort(int* numbers)
	{
		justify(numbers);
	}
  protected:
	int width_;
  private:
	virtual void justify(int* numbers) = 0;
};

class EasySortStrategy: public Strategy
{
public:
	EasySortStrategy(int width): Strategy(width){}
private:
	/*virtual*/void justify(int* numbers)
	{
		//std::sort(numbers, numbers + width_);
	}
};

class MySortStrategy: public Strategy
{
public:
	MySortStrategy(int width): Strategy(width){}
private:
	/*virtual*/void justify(int* numbers)
	{
		std::sort(numbers, numbers + width_);
	}
};

void SortStrategies::setStrategy(int numberOfElements)
{
	delete strategy_;
	if (numberOfElements < 2)
		strategy_ = new MySortStrategy(numberOfElements);
	else
		strategy_ = new EasySortStrategy(numberOfElements);
}



void SortStrategies::sort(int* numbers)
{
	strategy_->sort(numbers);
}

#endif //__STRATEGIES_H